import 'dart:async';

import 'package:drm/base/tj_date_entity.dart';
import 'package:drm/char_view/two_entity.dart';
import 'package:drm/http/date_result.dart';

import 'package:drm/http/action.dart';

abstract class ChartPageEvent {}

abstract class GetDateEvent<T> extends ChartPageEvent {
  Map<String, String> data;
  Map<String, String> queryParams;

  GetDateEvent(this.data, {this.queryParams});

  Future<T> getHttpData();
}

class PageGetDateEvent extends GetDateEvent<DateResult<List<TjDateEntity>>> {
  String unit;
  PageGetDateEvent(data, {queryParams,this.unit}) : super(data, queryParams: queryParams);

  Future<DateResult<List<TjDateEntity>>> getHttpData() async {
    return await ActionDo.getDate<TjDateEntity>(data);
  }
}

class PageGetTwoDateEvent extends GetDateEvent<DateResult<List<TwoEntity>>> {

  PageGetTwoDateEvent(data, {queryParams}) : super(data, queryParams: queryParams);
  @override
  Future<DateResult<List<TwoEntity>>> getHttpData() async {
    return await ActionDo.getDate<TwoEntity>(data);
  }
}



class PageGetThreeDateEvent extends GetDateEvent<DateResult<List<TjDateEntity>>> {
  PageGetThreeDateEvent(data, {queryParams}) : super(data, queryParams: queryParams);

  Future<DateResult<List<TjDateEntity>>> getHttpData() async {
    return await ActionDo.getDate<TjDateEntity>(data);
  }
}
